package com.micro.eduservice.service.impl;
import com.micro.eduservice.entity.EduTeacher;
import com.micro.eduservice.mapper.EduTeacherMapper;
import com.micro.eduservice.service.EduTeacherService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class EduTeacherServiceImpl extends ServiceImpl<EduTeacherMapper, EduTeacher> implements EduTeacherService {
    

    @Override
    public  Map<String, Object> getTeacherFrontList(Page<EduTeacher> pageParam)
    {
       QueryWrapper<EduTeacher> wrapper =new QueryWrapper<>();
       wrapper.orderByDesc("id");
       baseMapper.selectPage(pageParam,wrapper);

       List<EduTeacher> records=pageParam.getRecords();
       long current=pageParam.getCurrent();
       long pages=pageParam.getPages();
       long size=pageParam.getSize();
       long total = pageParam.getTotal();
       boolean hasNext=pageParam.hasNext();// 下一页
       boolean hasPrevious=pageParam.hasPrevious();// 上一页

       Map<String, Object> map = new HashMap<>();
       map.put("items",records);
       map.put("current", current);
       map.put("pages", pages);
       map.put("size", size);
       map.put("total", total);
       map.put("hasNext", hasNext);
       map.put("hasPrevious", hasPrevious);

       //map返回
       return map;
       
    }

}